package cn.org.eshow.webapp.action.response;

import cn.org.eshow.model.Favorite;

import java.util.Date;

/**
 * 收藏返回对象
 */

public class FavoriteResponse {

    public Integer id;// 用户ID
    public Date addTime; //添加时间
    public Date updateTime; //更新时间
    public ProductResponse product;//商品返回对象
    public UserSimpleResponse user;//用户返回对象

    public FavoriteResponse() {

    }

    public FavoriteResponse(Favorite favorite) {
        this.id = favorite.getId();
        this.addTime = favorite.getAddTime();
        this.updateTime = favorite.getUpdateTime();
        if (favorite.getProduct() != null) {
            this.product = new ProductResponse(favorite.getProduct());
        }
        if (favorite.getUser() != null) {
            this.user = new UserSimpleResponse(favorite.getUser());
        }
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getAddTime() {
        return addTime;
    }

    public void setAddTime(Date addTime) {
        this.addTime = addTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public ProductResponse getProduct() {
        return product;
    }

    public void setProduct(ProductResponse product) {
        this.product = product;
    }

    public UserSimpleResponse getUser() {
        return user;
    }

    public void setUser(UserSimpleResponse user) {
        this.user = user;
    }
}
